﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using DbLibrary;
using DbLibrary.Abstracts;
using DbLibrary.DataBase;

namespace DbLibrary.DataBase
{
    public class CarRepository : RepositoryBase<Models.Car, Car>
    {
        protected override Table<Car> GetTable()
        {
            return context.Cars;
        }

        protected override Expression<Func<Car, Models.Car>> GetConverter()
        {
            return c => new Models.Car()
            {
                Id = c.Id,
                Name = c.Name,
                Test = c.Test,
            };
        }

        protected override void UpdateEntry(Car dbCar, Models.Car car)
        {
            dbCar.Name = car.Name;
            dbCar.Test = car.Test;
        }
    }
}
